package com.idanchuang.component.base.actuator.tomcat;

import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
import org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author yjy
 * Created at 2021/6/3 2:21 下午
 */
@Configuration
@ConditionalOnEnabledHealthIndicator("tomcat")
@AutoConfigureBefore(HealthIndicatorAutoConfiguration.class)
public class TomcatHealthIndicatorAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean(name = "tomcatHealthIndicator")
    public TomcatHealthIndicator tomcatHealthIndicator(MeterRegistry meterRegistry) {
        return new TomcatHealthIndicator(meterRegistry);
    }



}
